package exp1.test3;

/**
 * Created by 春旺 on 2017/9/25.
 */
public interface ListInterface<T> {
    /**
     * Gets the current number of entries in this bag.
     *
     * @return The integer number of entries currently in the bag.
     */
    public default int getCurrentSize() {
        return 0;
    }

    /** Sees whether this bag is empty.
     @return True if the bag is empty, or false if not. */
    public boolean isEmpty();

    /** Adds a new entry to this bag.
     @param newEntry The object to be added as a new entry.
     @return True if the addition is successful, or false if not. */
    public boolean add(T newEntry);

    /** Removes one unspecified entry from this bag, if possible.
     @return Either the removed entry, if the removal
     was successful, or null. */
    public T remove();

    /** Removes one occurrence of a given entry from this bag, if possible.
     @param anEntry The entry to be removed.
     @return True if the removal was successful, or false if not. */
    public boolean remove (T anEntry);

    /** Removes all entries from this bag. */
    public void clear();

    /** Counts the number of times a given entry appears in this bag.
     @return The number of times anEntry appears in the bag.
      * @param anEntry The entry to be counted.*/
    public int getFrequencyOf(T anEntry);

    /** Tests whether this bag contains a given entry.
     @param anEntry The entry to locate.
     @return True if the bag contains anEntry, or false if not. */
    public boolean contains(T anEntry);
}
